#pragma once

enum 
{
    EC_OK,
    EC_UNDEFINED,
    EC_TIMEOUT,
    EC_OUT_OF_RANGE,
    EC_REACH_LOWER_LIMIT,
    EC_REACH_UPPER_LIMIT,
    EC_USER_CANCELED,
    EC_INVALID_CALLER,
    EC_INSUFFICIENT_MEMORY,
    EC_BUSY,
    EC_THREAD_NOT_RUNNING,
    EC_GET_THREAD_INFO_FAILED,
    EC_SET_THREAD_INFO_FAILED,
    EC_KILL_THREAD_FAILED,
    EC_SYNC_THREAD_FAILED,
    EC_DETACH_THREAD_FAILED,
    EC_START_THREAD_FAILED,
    EC_THREAD_NOT_EXIST,
    EC_THREAD_ABORTED,
    EC_NONSENSE_OPERATION,
    EC_THREAD_STATE_ERROR,
    EC_ALREADY_DONE,



    E_WITH_SYSTEM_CALL_ERROR = 0x80000000,
};

#define MAKE_SYSERR(errcode)    ((errcode) | E_WITH_SYSTEM_CALL_ERROR)
#define IS_SYSERR(errcode)  (errcode & E_WITH_SYSTEM_CALL_ERROR)
#define ERRCODE(errcode)    (errcode & ~E_WITH_SYSTEM_CALL_ERROR)
